home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / bash_114.zip / bash-1.14.2 / support / FAQ < prev    next >
Text File  |  1993-03-23  |  9KB  |  203 lines

  1. This Frequently Asked Questions file is edited in -*- indented-text -*- mode.
  2.  
  3. If you are viewing this text in a GNU Emacs Buffer, you can type "M-2 C-x $" to
  4. get an overview of just the questions.  Then, when you want to look at the text
  5. of the answers, just type "C-x $".
  6.  
  7. To search for a question numbered XXX, type "M-C-s ^XXX:", followed by a C-r if
  8. that doesn't work, then type ESC to end the search.
  9.  
  10. 1: How do I convert all of my Csh aliases over to Bash aliases?
  11.   Bash uses a different syntax to support aliases than Csh does.  The
  12.   details can be found in the documentation.  We have provided a shell
  13.   script which does most of the work of conversion for you; this
  14.   script can be found in ./examples/alias-conv.sh.  Here is how you
  15.   use it:
  16.   
  17.       Start Csh in the normal way for you.  (e.g., "csh")
  18.   
  19.       Pipe the output of "alias" through "alias-conv.sh", saving the
  20.       results into "bash_aliases":
  21.   
  22.         alias | alias-conv.sh >.bash_aliases
  23.   
  24.       Edit "bash_aliases" carefully reading through any created
  25.       functions.  You will need to change the names of Csh specific
  26.       variables (like $cwd) to the Bash equivalents (like $PWD).  You
  27.       will also need to remove recursive references to commands which
  28.       are defined as functions.  For example, the Csh alias:
  29.   
  30.     alias cd 'cd \!*;echo $cwd'
  31.   
  32.       is converted to the Bash function:
  33.   
  34.     cd () 
  35.     { 
  36.       cd $*;
  37.       echo $cwd
  38.     }
  39.   
  40.       This function contains a self-pointing reference to "cd", which
  41.       should be changed to use the "builtin" version.  It also uses
  42.       the Csh variable `$cwd' which has an equivalent in Bash.
  43.       Precede the recursive reference with the word "builtin", and
  44.       change the name of the variable:
  45.   
  46.         cd () { builtin cd $*; echo $PWD }
  47.   
  48.       Merge the edited file into your ~/.bashrc.
  49.   
  50. 2: Background jobs have staggered output, as if there was no CR before the LF.
  51.   This is a result of bash using the BSD-style tty driver on Ultrix.  The BSD
  52.   driver ties input and output carriage return translation together with the
  53.   CRMOD bit.  (The CRMOD bit causes CR->LF translation on input and LF->CRLF
  54.   translation on output.)  Unless the CRMOD bit is cleared, it is impossible
  55.   to get a literal ^M in an input line.  Unfortunately, one of the effects of
  56.   clearing it is the loss of output processing you've observed. 
  57.   
  58.   The Ultrix Posix-style tty driver can't be used because it has serious
  59.   problems with losing typeahead when ICANON is switched on and off.  These
  60.   characters seem to reappear later without warning, usually when a
  61.   program that uses the BSD-style ioctls turns on CBREAK (e.g., `more').
  62.   
  63. 3: Bash's "test" different from "/bin/test"? ([ ! x -o x ] -> false)
  64.    Bash's builtin "test" implements the Posix.2 spec, which can be
  65.    summarized as follows (the wording is due to David Korn):
  66.    
  67.     Here is the set of rules for processing test arguments.
  68.   
  69.     0 Args: False
  70.     1 Arg:  True iff argument is not null.
  71.     2 Args: If first arg is !, True iff second argument is null.
  72.         If first argument is unary, then true if unary test is true
  73.         Otherwise error.
  74.     3 Args: If second argument is a binary operator, do binary test of $1 $3
  75.         If first argument is !, negate two argument test of $2 $3
  76.         Otherwise error.
  77.     4 Args: If first argument is !, negate three argument test of $2 $3 $4.
  78.         Otherwise unspecified
  79.     5 or more Args: unspecified.  (Historical shells would used their
  80.     current algorithm).
  81.    
  82.     The operators -a and -o are considered binary operators for the purpose
  83.     of the 3 Arg case.
  84.    
  85.    As you can see, the test becomes (not (x or x)), which is false.
  86.    
  87. 4: Completion listings can differ from `ls' in the number of columns output.
  88.   This can happen because `ls' calls stat () on every file before
  89.   listing the output, while GNU Readline only calls stat () on the
  90.   files when they are being printed.  This means that `ls' knows how
  91.   many characters will be added to each filename in advance, and can
  92.   accurately calculate the maximum length, while Bash must assume that
  93.   each filename will have characters added to it.
  94.   
  95. 5: Bash crashes when I do "cd".
  96.   If you have `cd' defined as a function, it is likely that the
  97.   function is recursively calling itself.  See the answer to question
  98.   1 above.
  99.   
  100. 6: Why does Bash sometimes say "Broken pipe"?
  101.   If a sequence of commands appear in a pipeline, and one of the
  102.   reading commands finishes before the writer has finished, the writer
  103.   receives a SIGPIPE signal.  Many other shells special-case SIGPIPE as
  104.   an exit status in the pipeline and do not report it.  For example,
  105.   in:
  106.   
  107.       ps -aux | head
  108.   
  109.   `head' can finish before `ps' writes all of its output.  In that case,
  110.   Bash will print `Broken pipe' to stderr on behalf of the `ps'
  111.   command.
  112.   
  113. 7: How can I use `!' to reinvoke a command starting with a digit?
  114.   If you had issued a command such as `8086engine foo', and then at a
  115.   later time wished to reinvoke the command, typing `!80' would probably
  116.   not work since Bash would think you meant the 80'th command in the
  117.   history, not the command starting with `80'.  You can type `!?80',
  118.   which says to re-execute the most recent command containing `80'.
  119.  
  120. Questions About Input Line Editing:
  121.  
  122. 1: What do things like this mean: C-h, M-C-a, RET, etc.?
  123.   
  124.   C-a means press the "a" key while holding down the "Control" key.  The
  125.   ASCII code this sends will generally be the value that would be sent by
  126.   pressing just "a" minus 96 or 64.  Either way it will be a number from 0
  127.   to 31.
  128.   
  129.   M-a means press the "a" key while holding down the "Meta" key.  The
  130.   ASCII code this sends is the sum of the ASCII code that would be sent by
  131.   pressing just "a" and 128.
  132.   
  133.   M-C-a means press the "a" key while holding down both the "Control" key
  134.   and the "Meta" key.  C-M-a is a synonym for M-C-a.
  135.   
  136.   * RET means press the "Return" key.  RET is the same as C-m.  This sends
  137.     ASCII code 13.
  138.   
  139.   * LFD means press the "Linefeed" key.  LFD is also the same as C-j.  This
  140.     sends ASCII code 10.  Under Unix, ASCII code 10 is more often called
  141.     "Newline".
  142.   
  143.   * DEL means press the "Delete" key.  DEL is the same as C-?.  This sends
  144.     ASCII code 127.  (WARNING: It is a misnomer to call C-? a "control" key,
  145.     since 127 has both bits 6 and 7 turned ON, and the rule for control keys
  146.     is that they have 6 and 7 turned OFF.  Also, on very few keyboards does
  147.     Control-? generate ASCII code 127.  In fact, Control-? (which is
  148.     actually Control-Shift-/) is more likely to generate C-_, ASCII code
  149.     31!)
  150.   
  151.   * ESC means press the "Escape" key.  ESC is the same as C-[.  This sends
  152.     ASCII code 27.
  153.   
  154.   * SPC means press the "Space" key.  This send ASCII code 32.
  155.   
  156.   * TAB means press the "Tab" key.  TAB is the same as C-i.  This send ASCII
  157.     code 9.
  158.   
  159.   For C-@ and C-^, usually you don't have to hold down the shift key and you
  160.   can type Control-2 or Control-6 instead.  For C-_, you may have to hold
  161.   down the shift key, typing Control-Shift-Hyphen.  C-@ can often be
  162.   generated by typing Control-Space.  C-@ is often called the NUL character,
  163.   and has ASCII value 0.  C-_ can often be generated by typing Control-7 or 
  164.   Control-/.  Try Control with all of the digits on your keyboard to see
  165.   what gets generated.
  166.   
  167.   To read more about this online, type "C-h i m emacs RET m characters
  168.   RET", and also "C-h i m emacs RET m keys RET".
  169.   
  170. 2: What do you mean when you write things like this: type "ESC a"?
  171.   
  172.   I will enclose key sequences that are longer than one key inside double
  173.   quotes.  These notations refer to single key strokes (some with
  174.   modifiers):
  175.   
  176.     C-x, M-x, M-C-x
  177.     RET, LFD, DEL, ESC, SPC, TAB
  178.   
  179.   I separate these from other keys within double quotes by spaces.  Any
  180.   real spaces that I write inside double quotes can be ignored, only SPC
  181.   means press the space key.  All other characters within double quotes
  182.   represent single keys (some shifted).
  183.   
  184. 3: What if I don't have a Meta key?
  185.   
  186.   Instead of typing M-a, you can type "ESC a" instead.  In fact, Emacs
  187.   converts M-a internally into "ESC a" anyway (depending on the value of
  188.   meta-prefix-char).
  189.   
  190. 4: What if I don't have an Escape key?
  191.   
  192.   Type C-[ instead.  This should send ASCII code 27 just like an Escape
  193.   key would.
  194.   
  195. 5: What does "M-x command" mean?
  196.   
  197.   "M-x command" means type M-x, then type the name of the command, then
  198.  
  199.  
  200. Local Variables:
  201. eval: (set-selective-display 2)
  202. End:
  203.